<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p>玩家1：小明</p>
    <script>
        const para = document.querySelector('p');
        para.addEventListener('click', updatenName);

        function updataName() {
            let name = prompt('输入一个新的名字：');
            para.textContent = '玩家1：' + name
        }
    </script>

</body>

</html>